using TMPro;
using UnityEngine;
using UnityEngine.UI;

namespace Client.Base
{
    public class UIPatch : MonoBehaviour
    {
        [SerializeField] private Slider slider_prg;
        [SerializeField] private TextMeshProUGUI txt_content;
        [SerializeField] private TextMeshProUGUI txt_prgTips;
        [SerializeField] private TextMeshProUGUI txt_prg;
        [SerializeField] private GameObject tips;


        public void SetProgress(float v)
        {
            int prg = (int)(v * 100);
            txt_prg.text = $"{prg}%";
            slider_prg.value = v;
        }


        public void ShowProgressMessage(string message)
        {
            txt_prgTips.text = message;
        }

        public void ShowErrorMessage(string message)
        {
            if (!tips.activeSelf)
                tips.SetActive(true);
            txt_content.text = message;
        }

        public void Release()
        {
            Destroy(gameObject);
        }

    }
}

